import instance from "@/utils/request";

export function list(page, size, user) {
  return instance({
    method: "post",
    url: `/user/list/${page}/${size}`,
    data: user
  });
}

export function getAllRole() {
  return instance({
    method: "get",
    url: `/role/getAll`
  });
}

export function add(user) {
  return instance({
    method: "post",
    url: `/user/add`,
    data: user
  });
}

export function getOne(id) {
  return instance({
    method: "get",
    url: `/user/${id}`
  });
}

export function del(id) {
  return instance({
    method: "delete",
    url: `/user/${id}`
  });
}

export function checkUsernameExist(username) {
  return instance({
    method: "post",
    url: `/user/checkUsernameExist`,
    data: `username=${username}`
  });
}
